import { useAppDispatch } from '@/store';
import { GET_THEME, ThemeType } from '@/store/reducers/layout';
import { useEffect } from 'react';
import { useSelector } from 'react-redux';

const useTheme = () => {
	const theme = useSelector(GET_THEME);
	useEffect(() => {
		// console.log('theme', theme);
		document.body.classList.toggle('light-theme', theme === ThemeType.LIGHT);
		document.body.classList.toggle('dark-theme', theme === ThemeType.DARK);
	}, [theme]);
};

export { useTheme };
